package com.lecture.java8.io;

import java.io.*;

/**
 * @author luyn
 * @version 1.0
 * @description 缓冲流的使用 提高流的效率
 * @date 2021/1/18 15:47
 */
public class BufferedTest {
    public static void main(String[] args) throws Exception {
        File file = new File("E:\\ZN\\1.txt");
        BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(file));

        InputStream is = new FileInputStream(file);
        InputStream isb = new BufferedInputStream(is);

        int len;
        byte[] buff = new byte[8];  
        while ((len = inputStream.read(buff)) != -  1) {
            String str = new String(buff, 0, len);
            System.out.print(str);
        }

        inputStream.close();
    }
}
